package com.qidian.common;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;


@Data
@AllArgsConstructor
@NoArgsConstructor
public class Result {

    // 响应码  200：成功  -1：失败
    private int code;

    // 响应数据
    private Object data;

    // 响应消息
    private String msg;



    /**
     * 成功返回
     * @param data
     * @return
     */
    public static Result success(Object data){
         return new Result(200,data,"success");
    }

    /**
     * 失败返回
     * @param msg
     * @return
     */
    public static Result fail(String msg){
        return  new Result(-1,null,msg);
    }
}
